from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
services = Service('chromedriver.exe')
driver = webdriver.Chrome(service = services)
driver.implicitly_wait(15) # 隐式等待 15s

driver.get('https://www.baidu.com')
title = driver.title # 获取标题
print(title)

text = driver.find_element(By.LINK_TEXT,"新闻").text # 获取新闻文本

# 判断标题是否是百度一下，你就知道
assert title == "百度一下，你就知道"
# 判断新闻文本是否正确
assert text == "新闻"



